﻿
using System;
using System.Collections.Generic;

namespace Test30.Engine
{
    public class AllDrop<T> : CollectionDropBase<T>, IDrop<T>
    {
        #region IDrop Members

        public IEnumerable<T> Create(int level)
        {
            foreach (DropChoice choice in Choices)
            {
                // see if this choice was dropped
                if ((Math.Abs(choice.Odds) < 1e-8) || (Rng.Float(TotalOdds) <= choice.Odds))
                {
                    foreach (var item in choice.Drop.Create(level))
                    {
                        yield return item;
                    }
                }
            }
        }

        #endregion
    }

}
